/*
 * @Description: Dialog 统一设定对应参数
 * @Author: James324
 * @Date: 2023-09-03 22:59:47
 * @LastEditors: James324
 * @LastEditTime: 2023-10-17 13:25:06
 */

export default () => {
    const dialogType = ref('');
    const dialogTitle = ref('');

    /**
     * 判断是新增还是编辑
     */
    const isAdd = (type: string) => type === 'add';

    /**
     * 设置 Dialog 标题
     */
    const setTitle = (type: string) => {
        dialogType.value = type;
        dialogTitle.value = isAdd(type) ? '新增' : '编辑';
    };

    return { dialogType, dialogTitle, isAdd, setTitle };
};
